home *** CD-ROM | disk | FTP | other *** search
- package Common.ParticleSystem
- {
- import Common.FastMath;
- import flash.display.MovieClip;
- import flash.geom.Point;
-
- public class Particle extends MovieClip
- {
-
-
- private var age:uint;
-
- private var active:Boolean;
-
- private var life:uint;
-
- private var scale:Point;
-
- public var weight:Number;
-
- private var rotateAuto:Boolean;
-
- private var rotationRate:Number;
-
- public var index:uint;
-
- private var velocity:Point;
-
- public function Particle()
- {
- velocity = new Point();
- scale = new Point();
- super();
- reset();
- }
-
- public function grow(param1:Number) : void
- {
- scaleX = scaleY = FastMath.lerp(ScaleBirth,ScaleDeath,param1);
- }
-
- public function get Life() : uint
- {
- return life;
- }
-
- public function get Active() : Boolean
- {
- return active;
- }
-
- public function set Weight(param1:Number) : *
- {
- this.weight = param1;
- }
-
- public function set Life(param1:uint) : *
- {
- this.life = param1;
- }
-
- public function set RotationRate(param1:Number) : *
- {
- this.rotationRate = param1;
- }
-
- public function set Active(param1:Boolean) : *
- {
- this.active = param1;
- visible = param1;
- }
-
- public function set ScaleBirth(param1:Number) : *
- {
- scale.x = param1;
- }
-
- public function set Index(param1:uint) : *
- {
- this.index = param1;
- }
-
- public function revive(param1:Number, param2:Number) : void
- {
- life = FastMath.variance(param1,param2);
- age = life;
- }
-
- public function get ScaleDeath() : Number
- {
- return scale.y;
- }
-
- public function reset() : *
- {
- life = 30;
- age = life;
- rotationRate = 0;
- rotateAuto = false;
- weight = 1;
- visible = true;
- velocity.x = 0;
- velocity.y = 0;
- mouseEnabled = false;
- }
-
- public function get Weight() : Number
- {
- return weight;
- }
-
- public function rotate() : void
- {
- if(rotateAuto)
- {
- this.rotation = Math.atan2(velocity.y,velocity.x) * FastMath.PIOVER180 - 90;
- }
- else
- {
- this.rotation += rotationRate;
- }
- }
-
- public function set RotateAuto(param1:Boolean) : *
- {
- this.rotateAuto = param1;
- }
-
- public function get ScaleBirth() : Number
- {
- return scale.x;
- }
-
- public function get Index() : uint
- {
- return index;
- }
-
- public function setVelocityDir(param1:Number, param2:int) : void
- {
- velocity = FastMath.magDir(param1,param2);
- }
-
- public function set Age(param1:uint) : *
- {
- this.age = param1;
- }
-
- public function set ScaleDeath(param1:Number) : *
- {
- scale.y = param1;
- }
-
- public function get Age() : uint
- {
- return age;
- }
-
- public function get Velocity() : Point
- {
- return velocity;
- }
- }
- }
-